Skip to content

Comments

🔨 スクリプトを更新#1928

Merged
haiiro2gou merged 1 commit intomasterfrom
dev/update-scripts
Feb 23, 2026
Merged

🔨 スクリプトを更新#1928
haiiro2gou merged 1 commit intomasterfrom
dev/update-scripts

Conversation

@ChenCMD
Copy link
Member

@ChenCMD ChenCMD commented Feb 23, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 23, 2026 07:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates two Scala scripts that handle packing operations for region data, improving their robustness and consistency. The changes enhance error reporting, refactor bounds handling, and add support for custom bounds specifications.

Changes:

  • Added line number tracking to CSV parsing for better error diagnostics
  • Introduced support for 9-parameter region format with custom X/Z bounds
  • Refactored bounds representation from single size values to 6-tuple (minX, maxX, minY, maxY, minZ, maxZ) for more precise control
  • Added error logging for invalid CSV lines

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
scripts/rtree-packing.scala.sc Updated regionsFromFile function to add zipWithIndex for line tracking, introduced bounds variable for clarity, added new 9-parameter case for custom X/Z bounds, and added error logging for invalid lines
scripts/outlier-packing.scala.sc Updated regionsFromFile function with same improvements as rtree-packing.scala.sc, plus fixed destructuring bug in the BoundingBox creation to properly handle the new 6-tuple bounds format
Comments suppressed due to low confidence (2)

scripts/rtree-packing.scala.sc:445

  • Empty lines from the CSV file will trigger the error message "Invalid line at index". Consider filtering out empty lines before processing to avoid noisy output. You can add .filter(_.nonEmpty) after zipWithIndex or before processing the lines.
  val dataPoints = lines.zipWithIndex
    .flatMap { case (line, index) =>
      line.split(",").map(_.trim) match {
          case Array(id, dim, x, y, z)                         =>
            val s = defaultSize.get
            val bounds = (s, s, s, s, s, s)
            Some(dim -> (id.toInt -> (Int3(x.toInt, y.toInt, z.toInt), bounds)))
          case Array(id, dim, x, y, z, size)                   =>
            val s = Math.max(size.toInt, 32)
            val bounds = (s, s, s, s, s, s)
            Some(dim -> (id.toInt -> (Int3(x.toInt, y.toInt, z.toInt), bounds)))
          case Array(id, dim, x, y, z, minX, maxX, minZ, maxZ) =>
            val s = defaultSize.get
            val bounds = (s + minX.toInt, s + maxX.toInt, s, s, s + minZ.toInt, s + maxZ.toInt)
            Some(dim -> (id.toInt -> (Int3(x.toInt, y.toInt, z.toInt), bounds)))
          case _                                               =>
            println(s"Invalid line at index $index: $line")
            None

scripts/outlier-packing.scala.sc:267

  • Empty lines from the CSV file will trigger the error message "Invalid line at index". Consider filtering out empty lines before processing to avoid noisy output. You can add .filter(_.nonEmpty) after zipWithIndex or before processing the lines.
  val dataPoints = lines.zipWithIndex
    .flatMap {
      case (line, index) => line.split(",").map(_.trim) match {
          case Array(id, dim, x, y, z)                         =>
            val s = defaultSize.get
            val bounds = (s, s, s, s, s, s)
            Some(dim -> (id.toInt -> (Int3(x.toInt, y.toInt, z.toInt), bounds)))
          case Array(id, dim, x, y, z, size)                   =>
            val s = Math.max(size.toInt, 32)
            val bounds = (s, s, s, s, s, s)
            Some(dim -> (id.toInt -> (Int3(x.toInt, y.toInt, z.toInt), bounds)))
          case Array(id, dim, x, y, z, minX, maxX, minZ, maxZ) =>
            val s = defaultSize.get
            val bounds = (s + minX.toInt, s + maxX.toInt, s, s, s + minZ.toInt, s + maxZ.toInt)
            Some(dim -> (id.toInt -> (Int3(x.toInt, y.toInt, z.toInt), bounds)))
          case _                                               =>
            println(s"Invalid line at index $index: $line")
            None

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@haiiro2gou haiiro2gou merged commit 1890237 into master Feb 23, 2026
6 checks passed
@haiiro2gou haiiro2gou deleted the dev/update-scripts branch February 23, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants